//Random Game Engine
//Copyright (C) 2013  Nikolay Dionisov

//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.



#ifndef __SHEDULER__H_INCLUDED__
#define __SHEDULER__H_INCLUDED__
#include <vector>
#include "..\SystemInterface.h"
#include "..\Managers\ManagerContainer.h"
#include "..\Managers\Task Manager\GeneralWorks.h"

namespace re
{
	namespace core
	{
		typedef struct _SYSSTATE
		{
			std::shared_ptr<ISystem> system;
			TaskId task;
			int time;
			int priority;
			float score;
		}SystemState;
		class Sheduler
		{
		public:
			Sheduler() {}
			~Sheduler() {}
			
			void AddSystem(ISystem* system, int priority);

			//ShutDowns all systems and removes them from the memory. All shutdown stuff is done here.
			void RemoveSystems(ManagerContainer* managers);

			void UpdateSystems(ManagerContainer* managers);
			std::vector<SystemState> systems_; 
		};
	}
}

#endif